
<?php //Mostrar participants si n'hi han
if ($comanda->comandaNumLines>0) {//Inici if
?>    

<table border="0">
    <tr>
        <td><b>Producte</b></td>
        <td><b>Quantitat</b></td>
        <td><b>Preu<b></td>
        <td><b>Subtotal<b></td>
        <td><b>Observacions</b></td>
        <td>&nbsp;</td>
    </tr>
<?php $total=0; ?>
<?php foreach($lines as $linia): 
    $total= $total + $linia->liniaProducte->preu*$linia->quantitat;
    ?>
    <tr>
        <td>
            <?php echo CHtml::link(CHtml::image('images/icons/view.png','Mostrar'),
                    array('producte/view', 'id'=>$linia->producte_id)); ?>
            <?php echo CHtml::encode($linia->liniaProducte->descripcio); ?>
        </td>
        <td><?php echo CHtml::encode($linia->quantitat); ?></td>
        <td><?php echo Yii::app()->NumberFormatter->formatCurrency($linia->liniaProducte->preu,"EUR"); ?></td>
        <td><?php echo Yii::app()->NumberFormatter->formatCurrency($linia->liniaProducte->preu*$linia->quantitat,"EUR"); ?></td>
        <td>
            <?php echo CHtml::encode($linia->observacions); ?>
        </td>
        <td>
            <?php echo CHtml::link(CHtml::image('images/icons/delete.png','Esborrar'),
                    array('#'), 
                    array('submit'=>array('comandalin/delete',
                            'id'=>$linia->id,
                            'com'=>$comanda->id),
                            'confirm'=>'Segur que vols esborrar el producte "'.
                                    $linia->liniaProducte->descripcio.'"?')); ?>
        </td>
    </tr>
<?php endforeach; ?>
    
</table>
<?php echo "<h2>Total a pagar: ".Yii::app()->NumberFormatter->formatCurrency($total, "EUR")."</h2>"; 
}//Fi if ?>